package priv.dajie.tzzq.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import priv.dajie.tzzq.dao.C5CsgoMapper;
import priv.dajie.tzzq.service.PlatformCsgoService;
import priv.dajie.tzzq.spider.model.CsgoItemInfo;
import priv.dajie.tzzq.spider.model.PlatformCsgoItem;

/**
 * @ClassName C5CsgoServiceImpl
 * @Description
 * @Author dajie
 * @Date 2019/11/10 1:28 上午
 * @Version V1.0
 **/

@Service
public class C5CsgoServiceImpl implements PlatformCsgoService {

    @Autowired
    private C5CsgoMapper c5CsgoMapper;

    @Override
    public boolean addItem(PlatformCsgoItem csgoItem) {
        return c5CsgoMapper.addItem(csgoItem);
    }

    @Override
    public boolean updateItem(PlatformCsgoItem csgoItem) {
        return c5CsgoMapper.updateItem(csgoItem);
    }

    @Override
    public boolean autoAddItem(PlatformCsgoItem csgoItem) {
        boolean success = updateItem(csgoItem);
        if (!success){
            success = addItem(csgoItem);
        }
        return success;
    }

    @Override
    public boolean autoAddInfo(CsgoItemInfo csgoItemInfo) {
        return false;
    }

    @Override
    public boolean addInfo(CsgoItemInfo csgoItemInfo) {
        return c5CsgoMapper.addInfo(csgoItemInfo);
    }

    @Override
    public boolean updateInfo(CsgoItemInfo csgoItemInfo) {
        return c5CsgoMapper.updateInfo(csgoItemInfo);
    }
}
